#!/bin/bash

listcom=$1

if [ $# -ne 1   ]
then
	echo "usage: xfindglade_list.sh  listforglade"
	exit 0
fi


for fitfile in `cat $listcom`
do
	echo $fitfile
	findglade $fitfile
	galaxylist=`echo $fitfile | sed 's/\.fit/.glade/g'`
	galaxysky=`echo $fitfile | sed 's/\.fit/.gladesky/g'`
	galaxyxy=`echo $fitfile | sed 's/\.fit/.gladexy/g'`
	
	cat $galaxylist | awk '{print($8,$9,$1)}' >$galaxysky
	sky2xy $fitfile @$galaxysky | awk '{print($5,$6,$3,$1,$2)}' | column -t >$galaxyxy
done
